//
//  buyConditionCell.m
//  jiMuOperate
//
//  Created by 翁仪 on 16/5/5.
//  Copyright © 2016年 jinXinFengLi. All rights reserved.
//

#import "buyConditionCell.h"

@implementation buyConditionCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createViewTitel:@"触发买入条件 :"];
        //        [self setingDate];
    }
    return self;
}
-(void)createViewTitel:(NSString *)titel
{
    CGFloat padingW=15;
    UILabel *biddingLabel = [ARC createLabelWithFrame:CGRectMake(padingW, 5, 120, 30) Font:14 Text:titel];
    biddingLabel.textAlignment = NSTextAlignmentLeft;

       biddingLabel.textColor = [UIColor blackColor];
    [self.contentView addSubview:biddingLabel];
    
    UIView *view1 = [self baseViewFrame:CGRectMake(padingW, biddingLabel.frame.size.height, (SCREEN_WIDTH-padingW*2)/3, 30) imageNamed:@"aut_ico_agree" Selected:@"aut_ico_agree" butTag:1007 titel:@"回调到位"];
    UIView *view2 = [self baseViewFrame:CGRectMake(view1.frame.origin.x+view1.frame.size.width, biddingLabel.frame.size.height, (SCREEN_WIDTH-padingW*2)/3, 30) imageNamed:@"aut_ico_agree" Selected:@"aut_ico_agree" butTag:1008 titel:@"探底拉升"];
    UIView *view3 = [self baseViewFrame:CGRectMake(view2.frame.origin.x+view2.frame.size.width, biddingLabel.frame.size.height, (SCREEN_WIDTH-padingW*2)/3, 30) imageNamed:@"aut_ico_agree" Selected:@"aut_ico_agree" butTag:1009 titel:@"二次回调"];
    
    [self.contentView addSubview:view1];
    [self.contentView addSubview:view2];
    [self.contentView addSubview:view3];


}
-(UIView *)baseViewFrame:(CGRect)Frame imageNamed:(NSString *)imageNamed Selected:(NSString *)SelectedImageNamed butTag:(NSInteger)butTag titel:(NSString *)titels {
    
    
    UIView *baseView = [ARC createViewWithFrame:Frame ];
    
    UIButton *but1 = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
    [but1 setImage:[UIImage imageNamed:imageNamed] forState:UIControlStateNormal];
    //    but1.selected = YES;
    [but1 setImage:[UIImage imageNamed:SelectedImageNamed] forState:UIControlStateSelected];
    but1.tag = butTag;
    [but1 addTarget:self action:@selector(triggerBuyClick:)
   forControlEvents:UIControlEventTouchUpInside];
    [but1 setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter];
    
    UILabel *Label1 = [ARC createLabelWithFrame:CGRectMake(but1.frame.origin.x+but1.frame.size.width, 0, 50, 30) Font:12 Text:titels];
    Label1.textAlignment = NSTextAlignmentLeft;
    Label1.textColor = [UIColor blackColor];
    
    [baseView  addSubview:but1];
    [baseView addSubview:Label1];
    [self.contentView addSubview:baseView];
    
    return baseView;
}


//触发买入条件
-(void)triggerBuyClick:(UIButton *)button{
    
    switch (button.tag) {
        case downBtn:
            NSLog(@"回调到位");
            break;
        case upBtn:
            NSLog(@"探底拉升");
            break;
        case secondDownBtn:
            NSLog(@"二次回调");
            break;
        default:
            break;
    }
}

@end